package ifi.card.main;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public  class Onsound extends ScreenActivity implements OnClickListener {

	
	//private boolean continueMusic = false;
	public boolean pausing = false;
	public static boolean iscontinue = true;
	

	
	protected void onCreate (Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		if (iscontinue){
			setContentView(R.layout.onsound);
//			Audio.setVolume(R.raw.gameframe, 0);
			Button bt_y = (Button)findViewById(R.id.bt_yes);
			bt_y.setOnClickListener(this);
			Button bt_n = (Button)findViewById(R.id.bt_no);
			bt_n.setOnClickListener(this);
			iscontinue = false;
		} else nextScreen();			
	}
	

	public void nextScreen() {
		continueMusic = true;
		Intent nextIntent = new Intent(this, MenuLogin.class);
		this.startActivity(nextIntent);
		finish();
	}

	@Override
	public boolean onTouchEvent(MotionEvent event) {
		return true;
	}
	@Override
	protected void onResume() {
		continueMusic = false;
		pausing = false;
		super.onResume();
	}
	@Override
	public void onPause() {
		if(!continueMusic) {
			Audio.pause(R.raw.gameframe);
		}
		pausing = true;
		super.onPause();
	}

	@Override
	public void onClick(View arg0) {
		// TODO Auto-generated method stub
		
		switch (arg0.getId()) {
		case R.id.bt_yes:
//			Audio.setVolume(R.raw.gameframe,0);
//			Audio.play(R.raw.gameframe, true);
			continueMusic=true;
			nextScreen();
			break;
		case R.id.bt_no:
//			Audio.setVolume(R.raw.gameframe,0.5f);
//			Audio.play(R.raw.gameframe, true);
			continueMusic=true;
			nextScreen();
			break;
		}
	}
}
